﻿using System;
using System.IO.Ports;
using System.Windows.Forms;
using WindowsFormsGUI.Entidades;

namespace WindowsFormsGUI
{
    public partial class MonedeitorFrm : Form
    {
        #region Atributos

        

        #endregion

        #region Constructor

        public MonedeitorFrm()
        {
            InitializeComponent();
        } 
        
        #endregion

        private void ProcesarImagenToolStripMenuItemClick(object sender, EventArgs e)
        {
            try
            {
                var webcamFrm = new WebCamFrm();
                webcamFrm.Show();
            }
            catch (Exception)
            {
                
                throw;
            }
        }

        private void ConfiguracionToolStripMenuItemClick(object sender, EventArgs e)
        {
            try
            {
                var puertoSerieFrm = new PuertoSerieFrm();
                puertoSerieFrm.Show();
            }
            catch (Exception)
            {
                
                throw;
            }
        }

        private void ResumenToolStripMenuItemClick(object sender, EventArgs e)
        {
            try
            {
                var resultadosFrm = new ResultadosFrm();
                resultadosFrm.Show();
            }
            catch (Exception)
            {
                
                throw;
            }
        }

        private void SalirToolStripMenuItemClick(object sender, EventArgs e)
        {
            try
            {
                this.Close();
            }
            catch (Exception)
            {
                
                throw;
            }
        }

        protected override void OnFormClosing(FormClosingEventArgs e)
        {
            try
            {
                base.OnFormClosing(e);

                if (e.CloseReason == CloseReason.WindowsShutDown) return;

                switch (MessageBox.Show(this, "Esta seguro que desea salir?", "Salir", MessageBoxButtons.YesNo, MessageBoxIcon.Question))
                {
                    case DialogResult.No:
                        e.Cancel = true;
                        break;
                    case DialogResult.Yes:
                        break;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
            }
        }
    }
}
